FROM golang:alpine AS builde

ENV GOPROXY https://goproxy.cn,direct

RUN mkdir /app
#相当于linux跑的cd
WORKDIR /app

COPY  ./ ./


COPY go.mod go.sum /app/
#引入依赖
RUN go mod tidy
#打包go项目
RUN go build main.go

FROM scratch

COPY --from=builde /app/main /app/main

COPY --from=builde /app/config.yaml ./config.yaml

CMD ["/app/main"]